'''
Created on Jan 10, 2013

@author: ncuneo
'''
from tile import *

class PlayedLetters(pygame.Surface):
    def __init__(self):
        self.tiles = []
        pygame.Surface.__init__(self, (pygame.display.get_surface().get_width(), 100))
        self.old_text = ""
        
    def add(self, tile):
        if(tile not in self.tiles):
            self.tiles.append(tile)
        else:
            self.tiles.remove(tile)
            
    def update(self, screen):
        text = ""
        for tile in self.tiles:
            text = text + tile.letter
        if text != self.old_text:
            self.fill(pygame.Color(255,255,255))
            font = pygame.font.Font(None, 96)
            text = font.render(string.upper(text), 1, (0, 0, 0))
            self.blit(text, (0, 0))
            screen.blit(self, (25, 650))
            self.old_text = text
            